import matplotlib.pyplot as plt
import numpy as np

plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False

x = np.linspace(-3, 3, 100)
y = np.linspace(-3, 3, 100)

np.meshgrid(x, y)
X, Y = np.meshgrid(x, y)
Z = np.sin(X) + np.cos(Y)

plt.figure(figsize=(10, 8))
contour = plt.contour(X, Y, Z, 30, cmap='hot')
plt.clabel(contour, inline=True, fontsize=8)
plt.title('热力图示例')
plt.colorbar(label='高度')
plt.grid(True, linestyle='--', alpha=0.5)
plt.ylabel('Y轴')
plt.xlabel('X轴')
plt.grid(True)
plt.show()